<template>
  <div class="info">
    <van-nav-bar title="详情" left-text="返回" left-arrow @click-left="onClickLeft" />
    <div class="title">{{info.messageTitle}}</div>
    <div class="time">{{info.createTime}}</div>
    <div class="content" v-html="info.messageData"></div>
    <div class="remark">{{info.remark}}</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      info: ""
    };
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      this.info = this.$route.query.info;
      let str = this.info.messageData;
      const src = str.indexOf('<img src="http://116.63.129.181:8080/upload');
      const temp = src + 4;
      if(src === -1) return;
      const classStr = " class='img' ";
      this.info.messageData = str.slice(0,temp) + classStr + str.slice(temp);
    },
    onClickLeft() {
      this.$router.go(-1);
    }
  }
};
</script>

<style>
.info {
  width: 100vw;
  height: 100vh;
  background: #ffffff;
}

.title {
  font-size: 32px;
  font-weight: bold;
  margin: 40px 20px;
}

.time {
  font-size: 28px;
  margin: 40px 20px;
  font-weight: 400;
}

.content {
  padding: 20px 20px;
  margin: 0 20px 20px;
  font-size: 28px;
  background-color: #eeeeee;
}
.content .img{
   width: 100%;
 }
.remark {
  font-size: 28px;
  margin: 40px 20px;
  font-weight: 400;
}
</style>
